package cn.gorit.common.exception;

import cn.gorit.common.enums.ResultEnums;

/**
 * @version v1.0
 * @Classname AdminException
 * @Description 自定义管理员异常
 * @Author Gorit
 * @Created by 2021/3/23 0:49
 * @IDLE IntelliJ IDEA
 **/
public class AdminException extends RuntimeException {
    private Integer errorCode = ResultEnums.ERROR.getCode();

    public AdminException() {
    }


    public AdminException(ResultEnums resultNum) {
        super(resultNum.getMsg());
        this.errorCode = resultNum.getCode();
    }

    public AdminException(ResultEnums resultNum, Throwable cause) {
        super(resultNum.getMsg(), cause);
        this.errorCode = resultNum.getCode();
    }


    public AdminException(Throwable cause) {
        super(cause);
    }


    public AdminException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public AdminException(String msg) {
        super(msg);
    }

    public AdminException(Integer errorCode, String msg) {
        super(msg);
        this.errorCode = errorCode;
    }


    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }
}
